#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main()
{
    // int fd = open("log.txt",O_WRONLY|O_CREAT,0666);
    // char buff[256];
    // int size = snprintf(buff,sizeof(buff)-1,"新建文件log.txt\n");
    // buff[size] = 0;
    // write(fd,&buff,strlen(buff));
    // close(fd);

    int fd = open("log.txt",O_RDONLY);
    char buff[256];
    ssize_t size = read(fd,buff,sizeof(buff)-1);
    buff[size] = 0;
    printf("%s\n",buff);
    close(fd);
    return 0;
}